import java.util.Scanner;

public class fibonacciSequence {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你求的斐波那契数列的项数：");
        int n = scan.nextInt() ;

        int f1 = 1;
        int f2 = 1;
        int f3 = 0;
        int i = 3;

        if(n == 1 || n == 2){
            f3 = 1;
        }else {

            while (i <= n && n >= 3) {

                f3 = f1 + f2;

                int temp = f2;
                f2 = f3;
                f1 = temp;

                i++;
            }
        }
        System.out.println("斐波那契数列的第" + n + "项是" + f3);
        scan.close();
    }
}
